home *** CD-ROM | disk | FTP | other *** search
/ PsL Monthly 1993 December / PSL Monthly Shareware CD-ROM (December 1993).iso / prgmming / dos / pascal / graftxt.com / GRAFTEXT.PAS < prev    next >
Encoding:
Pascal/Delphi Source File  |  1989-07-06  |  3.3 KB  |  160 lines

  1. unit graftext;
  2.  
  3. interface
  4.  
  5. type Gfonts = (Thin8,Thin14,Thin16,Brdwy19,Wndw19,Sans19);
  6.  
  7. var
  8.    pitch  : word;
  9.  
  10.  
  11.  
  12.  
  13. Procedure Gtxttran(gdx,gdy,color:word;st:string);
  14.  
  15. Procedure Gtxtsol(gdx,gdy,backgnd,color:word;st:string);
  16.  
  17. Procedure SetGfont(newfont:Gfonts);
  18.  
  19. Procedure SetYofset(yofs:word);  {number of scan lines to scroll up the screen}
  20.  
  21.  
  22.  
  23. { To Write on areas off the visible screen, consider the graphics page to be a
  24.   virtual space of 640 wide and 819 tall. (64K  addresses / (80 bytes/line)
  25.   = 819.2. At EGA resolution, you can have two separate virtual screens of 350
  26.   lines, with space left over. At 480 lines, you can have only 1 independent
  27.   screen (assuming 256K of video memory) }
  28.  
  29.  
  30.  
  31.  
  32.  
  33. implementation
  34.  
  35. var
  36.    fontlines   : word;
  37.    fontpointer : pointer;
  38.  
  39. {$L Graftex1}
  40. Procedure Gtran(gdx,gdy,color,fontlines:word;fontpointer:pointer;var st:string);
  41. external;
  42.  
  43.  
  44. {$L Graftex2}
  45. Procedure Gsol(gdx,gdy,backgnd,color,fontlines:word;fontpointer:pointer;var st:string);
  46. external;
  47.  
  48.  
  49.               { a transparent text writing routine}
  50. Procedure Gtxttran(gdx,gdy,color:word;st:string);
  51.  
  52. begin
  53.  
  54.       Gtran(gdx,gdy,color,fontlines,fontpointer,st);
  55. end;
  56.  
  57.  
  58.              { a text writing routine with solid background}
  59. Procedure Gtxtsol(gdx,gdy,backgnd,color:word;st:string);
  60.  
  61. begin
  62.       Gsol(gdx,gdy,backgnd,color,fontlines,fontpointer,st);
  63. end;
  64.  
  65.  
  66.  
  67.  
  68. { Note: other fonts can be linked by converting them to .OBJ files
  69.         to do this use BINOBJ. The supplied 8x8 font was converted as follows:
  70.  
  71.         BINOBJ 8x8.fnt 8x8 Font8
  72.  
  73. }
  74.  
  75.  
  76.  
  77.  
  78. {$L 8x8.obj}
  79. Procedure Font8;
  80. external;
  81.  
  82. {$L 8x14.obj}
  83. Procedure Font14;
  84. external;
  85. {$L 8x16.obj}
  86. Procedure Font16;
  87. external;
  88. {$L SANS19.obj}
  89. Procedure SANS1F19;
  90. external;
  91. {$L WNDWS19.obj}
  92. Procedure WINDOWSF19;
  93. external;
  94. {$L BRDW19.obj}
  95. Procedure BROADWAYF19;
  96. external;
  97.  
  98.  
  99. Procedure SetGfont(newfont:Gfonts);
  100.  
  101. begin
  102. case newfont of
  103.  
  104.    Thin8       : begin
  105.                     fontlines := 8;
  106.                     FontPointer := @Font8;
  107.                  end;
  108.  
  109.    Thin14      : begin
  110.                     fontlines := 14;
  111.                     FontPointer := @Font14;
  112.                  end;
  113.  
  114.    Thin16      : begin
  115.                     fontlines := 16;
  116.                     FontPointer := @Font16;
  117.                  end;
  118.  
  119.    Brdwy19      : begin
  120.                     fontlines := 19;
  121.                     FontPointer := @BroadwayF19;
  122.                  end;
  123.  
  124.    Wndw19      : begin
  125.                     fontlines := 19;
  126.                     FontPointer := @WindowsF19;
  127.                  end;
  128.  
  129.    Sans19      : begin
  130.                     fontlines := 19;
  131.                     FontPointer := @Sans1F19;
  132.                  end;
  133.  
  134. end;
  135. end;
  136.  
  137.  
  138.  
  139.  
  140.  
  141.  
  142. Procedure SetYofset(yofs:word);
  143. begin                           {set CRT controller Start Address hi/low}
  144.    yofs := yofs * 80;         {assuming 640 pixels, across screen is 80 bytes}
  145.    port[$3d4] := $C;
  146.    port[$3d5] := hi(yofs);
  147.    port[$3d4] := $D;
  148.    port[$3d5] := lo(yofs);
  149. end;
  150.  
  151.  
  152. {the pitch variable allows operation with SuperVGA modes: for example 800x600
  153.  would have a pitch of 100}
  154.  
  155. begin
  156. pitch := 80;  {default pitch for 640 by x modes }
  157. Fontlines := 14;           {default Font}
  158. FontPointer := @Font14;
  159.  
  160. end.